package cn.huiyunche.base.service.interfaces;

import cn.huiyunche.base.service.vo.Result;
import cn.huiyunche.base.service.vo.YeepayNotifyXmlRequestVo;
import com.cfca.util.pki.PKIException;
import org.dom4j.DocumentException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

/**
 * 易宝回调接口
 *
 * @author hdy [Tuffy]
 */
public interface YeepayService {

    /**
     * 易宝回调接口
     *
     * @param request
     * @return
     */
    void yeepNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, PKIException, DocumentException;

    /**
     * 签名
     *
     * @param hmacStr
     * @return
     * @throws PKIException
     * @throws UnsupportedEncodingException
     */
    String signHmac(String hmacStr) throws PKIException, UnsupportedEncodingException;

    /**
     * 解析易宝回调xml
     *
     * @param xml
     * @return
     */
    Result<YeepayNotifyXmlRequestVo> parseYeepayRequestXml(String xml) throws IOException, PKIException, DocumentException;
}
